<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-gengduo-copy" @tap="backPage"></view>
			<view class="text">邀请好友</view>
		</view>
		<!-- <view class="clear_box"></view> -->

		<view class="bg_box">
			<image class="bg01" src="../../static/img01/bg11.png" mode="widthFix"></image>
			<view class="share_content">
				<image class="bg02" src="../../static/img01/bg12.png" mode="widthFix"></image>
				<view class="erm_content">
					<view class="title">邀请二维码</view>
					<view class="ewm">
						<image src="../../static/img01/ewm.png" mode="widthFix"></image>
					</view>
					<view class="rule">长按图片即可保存二维码</view>
					<view class="menu_box">
						<!-- <button open-type='share' class="menu">立即邀请</button> -->
						<view class="menu" @tap="goShare">立即邀请</view>
					</view>

				</view>

			</view>
		</view>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				scrrol: false,
				info: '',
				info02: '',
				isShare: false,
			};
		},
		onLoad(options) {
			let that = this;
			if (options.isShare == 1) {
				that.isShare = true
			}
		},
		onShow() {
			let that = this;
			// that.loadData();
			// that.loadData02();

		},
		methods: {
			goShare() {
				let that = this;
				// #ifdef MP-WEIXIN
				wx.downloadFile({
					url: this.info.url, //图片服务器地址
					success: (res) => {
						wx.showShareImageMenu({
							path: res.tempFilePath, //转为本地地址showShareImageMenu进行分享
							success: (rex) => {

							},
							fail: (err) => {

							},
						});
					},
				});
				// #endif

			},
			loadData02() {
				let that = this;
				that.Net._post('auth/info', {
					provider: 'users'
				}, res => {
					if (res.code == 200) {
						//console.log(res.data);
						that.info02 = res.data;

					}
				});
			},
			// goShare(){
			// 	let that = this;
			// 	uni.share({
			// 		provider: "weixin",
			// 		scene: "WXSceneSession",
			// 		type: 2,
			// 		imageUrl: this.info.url,
			// 		success: function (res) {
			// 			console.log("success:" + JSON.stringify(res));
			// 		},
			// 		fail: function (err) {
			// 			console.log("fail:" + JSON.stringify(err));
			// 		}
			// 	});
			// },
			loadData() {
				let that = this;
				that.Net._get('invite_info', {}, res => {
					if (res.code == 200) {
						//console.log(res)
						that.info = res.data;
					}
				});
			},
			goHome() {
				let url = '/pages/index02/index02';
				uni.switchTab({
					url: url
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},
		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onShareAppMessage(res) {
			return {
				title: '扫码绑定亲情号',
				path: '/pages/personalcenter/share?isShare=1',
				imageUrl: this.info.url,
			}
		},
	};
</script>

<style>
	.scrrolHeader {
		background-color: #FFEEE2 !important;
	}

	page {
		background-color: #FFEEE2 !important;
		padding-bottom: 0 !important;
	}

	.header {
		background-color: transparent !important;
	}

	.header .text {
		background-color: transparent !important;
		color: #fff !important;
	}

	.header .back {
		color: #fff;
	}

	.bg_box {
		width: 100%;
		position: relative;
	}

	.bg_box .bg01 {
		width: 100%;
		display: block;
	}

	.bg_box .share_content {
		width: 100%;
		position: absolute;
		left: 0;
		top: 37vh;

	}
	
	.bg_box .share_content .bg02{
		width: 100%;
		display: block;
	}
	
	.bg_box .share_content .erm_content{
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;

	}
	
	.bg_box .share_content .erm_content .title{
		font-size: 4vw;
		color: #693700;
		font-weight: bold;
		width: 100%;
		text-align: center;
		margin-top: 3vw;
	}

	.bg_box .share_content .portrait_box {
		width: 100%;
	}

	.bg_box .share_content .portrait_box .portrait {
		width: 20vw;
		height: 20vw;
		margin: 50vw auto 0;
	}

	.bg_box .share_content .portrait_box .portrait image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}

	.bg_box .share_content .portrait_box .name {
		font-size: 4vw;
		color: #333;
		font-weight: bold;
		text-align: center;
		margin-top: 2vw;
	}

	.bg_box .share_content .ewm {
		width: 45vw;
		height: 45vw;
		margin: 4vh auto 0;
	}

	.bg_box .share_content .ewm image {
		width: 100%;
		display: block;
	}
	
	.bg_box .share_content .rule{
		width: 100%;
		text-align: center;
		color: #693700;
		margin-top: 2vh;
		font-size: 3vw;
	}

	.menu_box {
		width: 100%;
		padding: 7vh 0 0;
	}

	.menu_box .menu {
		width: 70%;
		height: 12vw;
		margin: 0 auto;
		line-height: 12vw;
		border-radius: 12vw;
		font-size: 4vw;
		color: #913608;
		font-weight: bold;
		text-align: center;
		background: linear-gradient(#FCEBCD, #FAD8A8);
	}

	.menu_box02 {
		width: 86%;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-around;
		background-color: #fff;
		padding: 6vw 0;
		border-radius: 3vw;
	}

	.menu_box02 .menu {
		flex: 1;
	}

	.menu_box02 .menu .num {
		font-size: 5vw;
		color: #E83F4D;
		font-weight: bold;
		text-align: center;
	}

	.menu_box02 .menu .text {
		font-size: 3.2vw;
		color: #666666;
		margin-top: 3vw;
		text-align: center
	}

	.rule {
		width: 100%;
		margin-top: 2vw;
		font-size: 3.2vw;
		color: #666;
		text-align: center;
	}
</style>